.. _entitytoentity: Set entity field from entity fields expression ============================================== :superscript:`Workflowtasksentitytoentity` .. image:: ../../_images/entitytoentity/entitytoentity_001.png :class: with-shadow :width: 400px :alt: workflow task editing .. image:: ../../_images/entitytoentity/entitytoentity_002.png :class: with-shadow :width: 400px :alt: workflow task editing | This workflow task allows you to define an expression with functions and entity fields and assign the result to a entity field. | The task is for all entity modules. | The task form allows you to define an expression of formulas and entity field names to produce a value to be inserted into a target entity field. There is a pop-up window with all available functions and fields. | It is very important to remember, for complex expressions, that every function and sub-expression must be enclosed in parentheses. ============================= Calculated value (expression) ============================= Let's see in detail Functions --------- * :guilabel:`concat(fieldA, fieldB, ...)`: concatenates fields separated by commas. You can also insert a function in place of the field or a string * :guilabel:`time_diffdays([datefieldA], datefieldB)`: calculates the difference, in days, between dates contained in datefieldA and datefieldB. Parameter “datefieldA” is optional, if omitted the reference date is the execution date * :guilabel:`time_diff([datefieldA], datefieldB)`: calculates the difference, in seconds, between dates contained in datefieldA and datefieldB. Parameter “datefieldA” is optional, if omitted the reference date is the execution date * :guilabel:`add_days([datefield], days)`: adds a number of days (days) to the date contained in the datefield field. Parameter “datefield” is optional, if omitted the reference date is the execution date * :guilabel:`sub_days([datefield], days)`: subtracts a number of days (days) from the date contained in the datefield field. Parameter “datefield” is optional, if omitted the reference date is the execution date * :guilabel:`add_time([timefield], minutes)`: adds a number of minutes (minutes) to the data contained in the datefield field. It returns only time part. Parameter “timefield” is optional, if omitted reference date is the execution time * :guilabel:`add_time_wdate([timefield], minutes)`: adds a number of minutes (minutes) to the data contained in the datefield field. It returns date and time part. Parameter “timefield” is optional, if omitted reference date is the execution time * :guilabel:`sub_time([timefield], minutes)`: subtracts a number of minutes (minutes) from the date contained in the datefield field. It returns only time part. Parameter “timefield” is optional, if omitted reference date is the execution time * :guilabel:`sub_time_wdate([timefield], minutes)`: subtracts a number of minutes (minutes) from the date contained in the datefield field. It returns date and time part. Parameter “timefield” is optional, if omitted reference date is the execution time * :guilabel:`get_datetime('Y-m-d H:i:s', [timefield])`: the current date-time formatted by PHP rules https://www.php.net/manual/en/datetime.format.php * :guilabel:`Today`: the date in which the task is executed * :guilabel:`Tomorrow`: date for the day following the execution of the task * :guilabel:`Yesterday`: the date of the day preceding the execution of the task * :guilabel:`intval(field)`: the integer number of the value contained in the field (also string) * :guilabel:`floatval(field)`: the decimal number of the value contained in the field (also string) * :guilabel:`integerformat(field)`: formats an integer number in the user format * :guilabel:`floatformat(field)`: formats a decimal number in the user format * :guilabel:`dateformat(field)`: formats, in the user format, the date contained in the field * :guilabel:`timeformat(field)`: formats a time value in the user format * :guilabel:`daytimeformat(field)`: formats “date time” value in the user format * :guilabel:`boolean('true'|'false')`: returns a boolean value 'true' or 'false' Specials -------- * :guilabel:`Double quotes`: inserts the double quotes (") * :guilabel:`Single quote`: inserts the single quote (') * :guilabel:`HTML break`: inserts a HTML break for the WYSIWYG * :guilabel:`Text new line`: inserts a new line for textarea * :guilabel:`If ... Then ... Else`: inserts a conditional statement :code:`If (condition) then expression else expression end`. The condition :code:`If (condition)` can be a camparison of two expressions with operators: :code:`==, <, <=, >, >=` Fields ------ The available fields are all fields configured for the module ============ Target field ============ The target field where the expression result will be saved. ============= Entity filter ============= | Allows you to select a filter, previously created, of the module you are assigning the task. | This filter allows you to apply further filtering, in addition to the one already available in the workflow, to filter the records on which to perform the task. ============ Add new rule ============ Allows you to add one or more rules to create tasks for assignments to different entity fields in the same workflow task.